package com.Arsanesia.TempleRush.Views.Screens;

import com.Arsanesia.TempleRush.TempleRush;
import com.Arsanesia.TempleRush.Controllers.Listeners.HelpClickListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.scenes.scene2d.ui.Image;

public class HelpScreen extends AbstractScreen{
	private final int MAX_HELP_INDEX = 3; //from 1-3 (3 elements)
	private final String HELP_STRING = "help";
	private Image helpImage;
	private int currentindex;
	public HelpScreen(TempleRush game){
		super(game);
		currentindex = 1;
	}
	@Override
	public void show(){
		super.show();
		atlas = new TextureAtlas(Gdx.files.internal("Images/Help/help.atlas"));
		helpImage = new Image(atlas.createSprite(HELP_STRING,currentindex));
		//get the actual height and width
		this.actualBgHeight = helpImage.getHeight();
		this.actualBgWidth = helpImage.getWidth();
		helpImage.addListener(new HelpClickListener(this));
		this.addActor(helpImage);
	}
	@Override
	public void resize(int width, int height){
		super.resize(width, height);
		//reset the viewport and camera position
		this.setViewport(actualBgWidth, actualBgHeight, false);
	}
	public void nextHelp(){
		currentindex++;
		Gdx.app.log("test", currentindex+"");
		if(currentindex<=MAX_HELP_INDEX)
		{
			helpImage = new Image(atlas.createSprite(HELP_STRING, currentindex));
			helpImage.addListener(new HelpClickListener(this));
			this.addActor(helpImage);
		}
		else
			game.setScreen(game.getMenuScreen());
	}
}
